package cn.supermaster.management.web.controller.system;

import cn.supermaster.management.web.service.system.ISNoticeService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 公告 信息操作处理
 */
@Controller
@RequestMapping("/system/notice")
public class SystemNoticeController {

    @Autowired
    private ISNoticeService noticeService;

    @RequiresPermissions("system:notice:view")
    @GetMapping()
    public String skipNoticeIndexHtml() {
        return noticeService.skipNoticeIndexHtml();
    }

    /**
     * 新增公告
     */
    @GetMapping("/add")
    public String add() {
        return noticeService.skipNoticeAddHtml();
    }

    /**
     * 修改公告
     */
    @GetMapping("/edit/{noticeId}")
    public String edit(@PathVariable("noticeId") Long noticeId, ModelMap modelMap) {
        return noticeService.skipNoticeModifyHtml(modelMap, noticeId);
    }
}
